package flc.ast.adapter;


import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.ConvertUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class FolderAdapter extends StkProviderMultiAdapter<String> {

    public FolderAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new FolderProvider());
    }

    private class FolderProvider extends BaseItemProvider<String> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_folder;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, String bean) {
            if (TextUtils.isEmpty(bean)) {
                baseViewHolder.setText(R.id.tvFolderItemName, getContext().getString(R.string.add_folder));
                baseViewHolder.setTextColor(R.id.tvFolderItemName, Color.parseColor("#B6B6B6"));
                baseViewHolder.setImageResource(R.id.ivFolderItemImg, R.drawable.axjwjj);
            } else {
                baseViewHolder.setText(R.id.tvFolderItemName, FileUtils.getFileName(bean));
                baseViewHolder.setTextColor(R.id.tvFolderItemName, Color.parseColor("#5B5B5B"));
                baseViewHolder.setImageResource(R.id.ivFolderItemImg, R.drawable.ajmwjj);
            }
        }
    }

}
